vehicleSamp = {
  initPage:function() {
    this.data = {
      pageNum: 3,
      shengColum: [
        {field: 'vehicleNo',title: '车牌号码'},
        {field: 'vehicleColor',title: '车牌颜色'}
      ],
      queryData: {
        page: 1,
        size: 10
      },
      SearchCarTableData: [],
      searchCarRightTableData: [],
      selectCarArrData: [],
      queryCarData: {
        page: 1,
        size: 10,
        areaId: "",
        platformName: "",
        owersName: "",
        vehicleNo: "",
        transType: ""
      },
      tableData: [], // table data
      total: 0,
      attr: [],
      // BuSamplingReport: [
      //   {
        //   field: 'no',
        //   title: '序号',
        //   align: 'center',
				// 	formatter: function(value, row, index) {
				// 		return index + 1;
				// 	}
        // },
      //   {
      //       field: 'hfsj',
      //       title: '抽检年月',
      //       visible: false
      //   },
      //   {
      //       field: 'carPi',
      //       title: '抽检类型'
      //   },
      //   {
      //       field: 'tongdao',
      //       title: '抽检时间',
      //   },
      //   {
      //       field: 'wenjian',
      //       title: '抽检用户',
      //   },
      //   {
      //       field: 'lshfsj',
      //       title: '报表名称',
      //   },
      //   {
      //       field: 'caozuo',
      //       title: '操作',
      //   },
      // ],
      // BuSamplingVehicle: [
      //   {
        //   field: 'no',
        //   title: '序号',
        //   align: 'center',
				// 	formatter: function(value, row, index) {
				// 		return index + 1;
				// 	}
        // },
      //   {
      //       field: 'hfsj',
      //       title: '月份',
      //       visible: false
      //   },
      //   {
      //       field: 'carPi',
      //       title: '所属地区'
      //   },
      //   {
      //       field: 'tongdao',
      //       title: '所属平台',
      //   },
      //   {
      //       field: 'wenjian',
      //       title: '所属企业',
      //   },
      //   {
      //       field: 'lshfsj',
      //       title: '车牌号码',
      //   },
      //   {
      //       field: 'caozuo',
      //       title: '行业类别',
      //   },
      // ],
      ZiSamplingReport: [
        {
          field: 'no',
          title: '序号',
          align: 'center',
					formatter: function (value, row, index) {
            var pageSize = vehicleSamp.data.queryData.size;
            var pageNumber = vehicleSamp.data.queryData.page;
            return pageSize * (pageNumber - 1) + index + 1;
          }
        },
        {
            field: 'time',
            title: '抽检年月',
        },
        {
            field: 'batch',
            title: '抽检批次',
        },
        {
            field: 'createTime',
            title: '抽检时间',
        },
        {
            field: 'name',
            title: '报表名称',
        },
        {
          field: 'Button',
          title: '操作',
          width: "90",
          align: 'center',
          events: operateEvents,
        }
      ],
      ZiSamplingVehicle: [
        {
          field: 'no',
          title: '序号',
          align: 'center',
					formatter: function (value, row, index) {
            var pageSize = vehicleSamp.data.queryData.size;
            var pageNumber = vehicleSamp.data.queryData.page;
            return pageSize * (pageNumber - 1) + index + 1;
          }
        },
        {
            field: 'checkTime',
            title: '抽检年月',
            visible: false
        },
        {
            field: 'batch',
            title: '抽检批次'
        },
        {
            field: 'areaName',
            title: '地区',
        },
        {
            field: 'platformName',
            title: '平台',
        },
        {
            field: 'owersName',
            title: '企业',
        },
        {
            field: 'vehicleNo',
            title: '车牌号码',
        },
        {
            field: 'vehicleColor',
            title: '车辆颜色',
            visible: false
        },
        {
            field: 'transTypeName',
            title: '抽检类型',
        },
        {
            field: 'createTime',
            title: '抽检时间',
        },
      ],
      carSearchListColumn: [
        {   field : 'checked',
            checkbox: true,
            width: "60"
        },
        {
          field: 'no',
          title: '序号',
          align: 'center',
					formatter: function (value, row, index) {
            var pageSize = vehicleSamp.data.queryCarData.size;
            var pageNumber = vehicleSamp.data.queryCarData.page;
            return pageSize * (pageNumber - 1) + index + 1;
          }
        },
        {
          field: 'areaName',
          title: '地区',
        },
        {
          field: 'platformName',
          title: '平台',
        },
        {
          field: 'owersName',
          title: '企业',
        },
        {
          field: 'vehicleNo',
          title: '车牌号',
        },
        {
          field: 'vehicleColor',
          title: '车牌颜色',
        },
        {
          field: 'transTypeName',
          title: '抽检类型',
        },
      ]
    };
    this.initTime();
    this.btnEvent();
    this.selectedValue(); //select  option内容填充
    this.resetQueryData();
    this.getZiSampReport();
    this.selectInputInit();
  },
  /**
   * 地区input级联选择
   */
  selectInputInit() {
    jrequest.get("/api/assessMent/selectByArea",{}).then(res => {
      var data = res.data;
      data[0].code=1;
				$.each(data[0].cityAreaVOS,function(i,dom){
					data[0].cityAreaVOS[i].code=2;
					$.each(data[0].cityAreaVOS[i].cityAreaVOS,function(j,dom){
						data[0].cityAreaVOS[i].cityAreaVOS[j].code=3;
					})
				})
				this.creatMainRidoTOP("qrm-main-car",data,"cityAreaVOS","code");
    })
  },
  selectQueryCarInputInit() {
    jrequest.get("/api/assessMent/selectByArea",{}).then(res => {
      var data = res.data;
      data[0].code=1;
				$.each(data[0].cityAreaVOS,function(i,dom){
					data[0].cityAreaVOS[i].code=2;
					$.each(data[0].cityAreaVOS[i].cityAreaVOS,function(j,dom){
						data[0].cityAreaVOS[i].cityAreaVOS[j].code=3;
					})
				})
				this.creatMainRidoDOWN("qrm-main-search",data,"cityAreaVOS","code");
    })
  },
  creatMainRidoTOP:function(id,attr,child,jibie){
		$(id).html("");
		var sttrdiv="";
		for(var i=0;i<3;i++){
			sttrdiv +="<div class='qrm-border"+(i+1)+"' style='display:none'>"+
				"<ul class='qrm-lev-"+(i+1)+" qrm-lev' id='qrm-border1'>"+
				"</ul>"+
				"</div>"
		};
		$(".qrm-main").html(sttrdiv);
		var str="";
		$("#qrm-border1").html("");
		var forTree = function(o){
			for(var i=0;i<o.length;i++){
				var urlstr = "";
				try{
					urlstr = "<li><span data-id='"+o[i]["id"]+"'>"+ o[i]["name"] +"</span><i class='qrm-arrow-right'></i><ul class='li-zi-"+o[i][jibie]+"' style='display: none'>";
					str += urlstr;
					if(o[i][child] != null){
						forTree(o[i][child]);
					}
					str += "</ul>";
				}catch(e){}
			}
			return str;
		};
		$("#qrm-border1").html(forTree(attr));
	},
  creatMainRidoDOWN:function(id,attr,child,jibie){
		$(id).html("");
		var sttrdiv="";
		for(var i=0;i<3;i++){
			sttrdiv +="<div class='qrm-border"+(i+1)+"' style='display:none'>"+
				"<ul class='qrm-lev-"+(i+1)+" qrm-lev' id='qrm-border1'>"+
				"</ul>"+
				"</div>"
		};
		$(".qrm-main").html(sttrdiv);
		var str="";
		$("#qrm-border1").html("");
		var forTree = function(o){
			for(var i=0;i<o.length;i++){
				var urlstr = "";
				try{
					urlstr = "<li><span data-id='"+o[i]["id"]+"'>"+ o[i]["name"] +"</span><i class='qrm-arrow-right'></i><ul class='li-zi-"+o[i][jibie]+"' style='display: none'>";
					str += urlstr;
					if(o[i][child] != null){
						forTree(o[i][child]);
					}
					str += "</ul>";
				}catch(e){}
			}
			return str;
		};
		$("#qrm-border1").html(forTree(attr));
	},
  initBootTable(id,data,columns,total) {
    let that = this
    data.forEach(item => {
      item.Button = this.operateFormatter()
    })
    $('#' + id).bootstrapTable({
      method: 'get',
      cache: false,
      height: 200,
      pagination: true,
      pageSize: that.data.queryData.size,
      pageNumber: that.data.queryData.page,
      showColumns: true,
      striped: true,
      columns: columns,
      data :data,
      sidePagination: 'server', // client or server 是否后台分页
      totalRows: total,
      onPageChange: function (size, number) {
        vehicleSamp.data.queryData.size = size;
        vehicleSamp.data.queryData.page = number;
        vehicleSamp.queryTableData();
      },
      formatNoMatches: function(){
        return '暂无数据';
      }
    });
  },
  operateFormatter(value,row,index) {
    return [
        // '<span id="table_Download" class="downFile" style="cursor: pointer;">下载</span>'
        '<span id="table_detail" class="downFile" style="cursor: pointer;">下载</span>'
    ].join('');
  },
  initChartsTable(id,data,columns) {
    $("#" + id).bootstrapTable({
      method: 'get',
      cache: false,
      // height: 420,
      pagination: false,
      // pageSize: 10,
      // pageNumber:1,
      showColumns: false, // 显示列显示控制按钮
      striped: true,
      columns: columns,
      data :data,
      onPageChange: function (size, number) {

      },
      formatNoMatches: function(){
          return '暂无数据';
      }
    });
  },
  initTime() {
    //选择月
    $('.J-yearMonthPicker-single').datePicker({
      format: 'YYYY-MM',
      // min: '2018-01',
      // max: '2019-04',
      hide: function (type) {
        console.info(this.$input.eq(0).val());
      }
    });
    //选择年
    $('.J-yearPicker-single').datePicker({
      format: 'YYYY',
      // min: '2018',
      // max: '2020'
    });
    $(".J-yearPicker-single").hide();
    // this.driveDefaultTime();
  },
  driveDefaultTime() { // 时间默认项设置
    let year = String(moment().year());
    let mon = String(moment().month() + 1);
    let month = mon > 9 ? mon : "0" + mon;
    let date = String(moment().date());
    let defaultYear = year;
    let defaultMonth = `${year}-${month}`;
    $("#samplingTimeSeleteM").val(defaultMonth);
    $("#samplingTimeSeleteY").val(defaultYear);
  },
  // getBuSampReport() { // 部抽检报表查询
  //   // jrequest.get("",this.getQueryData()).then(res => {
  //   // })
  //   $('#cnf_reportTable').bootstrapTable('destroy');
  //   this.initBootTable("cnf_reportTable",this.data.tableData,this.data.BuSamplingReport,this.data.tableData.length);
  // },
  // getBuSampVehicle() { // 部抽检车辆查询
  //   // jrequest.get("",this.getQueryData()).then(res => {
  //   // })
  //   $('#cnf_reportTable').bootstrapTable('destroy');
  //   this.initBootTable("cnf_reportTable",this.data.tableData,this.data.BuSamplingVehicle,this.data.tableData.length);
  // },
  getZiSampReport() { // 抽检报表查询
    jrequest.get("/api/spotCheckExcel/listSpotCheckExcel",this.getQueryData()).then(res => {
      if (res.data) {
        this.data.tableData = res.data;
        this.data.total = res.total;
      }
      $('#cnf_reportTable').bootstrapTable('destroy');
      this.initBootTable("cnf_reportTable",this.data.tableData,this.data.ZiSamplingReport,this.data.total);
    })
  },
  getZiSampVehicle() { // 抽检车辆查询
    jrequest.get("/api/spotCheck/listSpotCheck",this.getQueryData()).then(res => {
      if (res.data) {
        this.data.tableData = res.data;
        this.data.total = res.total;
      }
      $('#cnf_reportTable').bootstrapTable('destroy');
      this.initBootTable("cnf_reportTable",this.data.tableData,this.data.ZiSamplingVehicle,this.data.total);
    })

  },
  getCarInfoList() { // 查询抽检车辆 车辆列表数据获取 渲染
    this.data.queryCarData.areaId = $(".qrm-input-search").val() || ""; // attr("data-id");
    this.data.queryCarData.platformName = $(".queryCar_plat input").val();
    this.data.queryCarData.owersName = $(".queryCar_owers input").val();
    this.data.queryCarData.vehicleNo = $(".queryCar_vehicle input").val();
    // this.data.queryCarData.transType = $("#selectIndustry_type").val();
    this.data.queryCarData.transType = $(".carlist_industry .combo-select .combo-dropdown li.option-selected").index(); // 抽检类型赋值
    jrequest.get('/api/vehicle', this.data.queryCarData).then(res => {
      this.data.SearchCarTableData = res.data;
      this.data.total = res.total;
      this.initSearchCarListTable();
    })
  },
  initSearchCarListTable() { // 车辆列表初始化
    if (this.data.SearchCarTableData.length > 0) {
      $(".select_carbtn button").attr("disabled",false);
      $(".select_carbtn button").removeClass("btndisabled")
    } else {
      $(".select_carbtn button").attr("disabled",true);
      $(".select_carbtn button").addClass("btndisabled")
    }
    $('#carInformationList').bootstrapTable('destroy');
    this.initBootTable("carInformationList",this.data.SearchCarTableData,this.data.carSearchListColumn,this.data.total);
  },
  getCarSearchRightData() { // 获取启动抽检下方表格数据  随机抽检
    var queryData = {};
    var sizeNum = $(".select_carbtn .combo-select .combo-input");
    queryData.areaId = $(".qrm-input-search").val() || ""; // attr("data-id");
    queryData.platformName = $(".queryCar_plat input").val();
    queryData.owersName = $(".queryCar_owers input").val();
    queryData.vehicleNo = $(".queryCar_vehicle input").val();
    queryData.transTypeCode = $("#selectIndustry_type").val();
    queryData.size = sizeNum.val().slice(0,sizeNum.val().length - 1);
    queryData.total = this.data.total;
    jrequest.get("/api/vehicles/listCheckVehicles",queryData).then(res => {
      this.data.searchCarRightTableData = res.data;
      this.initSearchCarTableRight();
    })
  },
  initSearchCarTableRight() { // 启动抽检下方表格初始化
    if(this.data.searchCarRightTableData.length > 0) {
      $(".queryCaritem button").attr("disabled",false);
      $(".queryCaritem button").removeClass("btndisabled");
    }
    $('#chartsDataList').bootstrapTable('destroy');
    this.initChartsTable("chartsDataList",this.data.searchCarRightTableData,this.data.shengColum);
  },
  createSamplingInfo() { // 生成抽检信息
    jrequest.get("/api/spotCheck/addExcel",this.getQueryData()).then(res => {
      // console.log(res.data)
    })
  },
  queryTableData() {
    switch(this.data.pageNum) {
      // case 1:
      //   vehicleSamp.getBuSampReport();
      //   break;
      // case 2:
      //   vehicleSamp.getBuSampVehicle();
      //   break;
      case 3:
        vehicleSamp.getZiSampReport();
        break;
      case 4:
        vehicleSamp.getZiSampVehicle();
        break;
      case 5:
        vehicleSamp.getCarInfoList();
        break;
    }
  },
  getQueryData() {
    var queryData = {};
    let type = $("#monDateType").val() || "月";
    let dateTime = "";
    if (type === "年") {
      dateTime = $("#samplingTimeY").val();
    } else if (type === "月") {
      dateTime = $("#samplingTimeM").val();
    }
    // let batchValue =  $(".cgstatus_num .combo-select .combo-input").val();
    let batchValue =  $("#samplingBatck").val();
    switch(this.data.pageNum) {
      // case 1:
      //   queryData.page = this.data.queryData.page;
      //   queryData.size = this.data.queryData.size;
      //   queryData.time = $("#samplingTimeM").val();
      //   queryData.areaId = $(".areaName input").val();
      //   break;
      // case 2:
      //   queryData.page = this.data.queryData.page;
      //   queryData.size = this.data.queryData.size;
      //   queryData.time = $("#samplingTimeM").val();
      //   queryData.areaId = $(".areaName input").val();
      //   queryData.vehicleNo = $(".vehicleNo input").val();
      //   queryData.transType = $("#industryType").val();
      //   break;
      case 3:
        queryData.page = this.data.queryData.page;
        queryData.size = this.data.queryData.size;
        queryData.time = dateTime; // 不需要时间类型  由时间格式控制
        queryData.batch = batchValue === '全部' ? "" : batchValue;
        break;
      case 4:
        queryData.page = this.data.queryData.page;
        queryData.size = this.data.queryData.size;
        queryData.createTime = dateTime;
        queryData.transType = $(".work_type .combo-select .combo-dropdown li.option-selected").index(); // 抽检类型赋值
        queryData.areaId = $(".j-search-row.report_vehicle .item").eq(2).find("input").attr("data-id") || "";
        queryData.batch = batchValue === '全部' ? "" : batchValue;
        break;
      case 5:
        break;
    }
    return queryData;
  },
  resetQueryData() {
    this.data.queryData.page = 1;
    $("#samplingTimeM").val('');
    $("#samplingTimeY").val('');
    $(".select_MYtime .combo-select .combo-input").val("月");
    $(".J-yearPicker-single").hide();
    $(".J-yearMonthPicker-single").show();
    $(".cgstatus_num .combo-select .combo-input").val("全部");
    $(".work_type .combo-select .combo-dropdown li:first-child").addClass("option-selected").siblings().removeClass("option-selected"); // 抽检类型
    $(".work_type .combo-select .combo-input").val("全部");
    $(".qrm-input-car").val(''); // 地区
    $(".j-search-row.report_vehicle .item").eq(2).find("input").attr("data-id","")
    $(".platformName input").val('');
    $(".owersName input").val('');
    $(".vehicleNo input").val('');
    $("#samplingBatck").val("")
    // this.queryTableData();
  },
  resetSearchCarQueryData() {
    $(".queryCar_time .combo-select .combo-input").val("月");
    this.driveDefaultTime();
    $(".qrm-input-search").val(''); // 地区
    $(".J-yearPicker-single.searchcar").hide();
    $(".J-yearMonthPicker-single.searchcar").show();
    $(".select_carbtn .combo-select .combo-input").val("5%");
    $(".carlist_industry .combo-select .combo-dropdown li:first-child").addClass("option-selected").siblings().removeClass("option-selected"); // 抽检类型
    $(".carlist_industry .combo-select .combo-input").val("全部");
    $("#selectIndustry_type").val(-1);
    $(".queryCar_vehicle input").val('');
    $(".queryCar_plat input").val('');
    $(".queryCar_owers input").val('');
  },
  /**
   * 下载
   */
  downloads(id,name) {
    // if (!data) {
    //   return
    // }
    const url = `http://1.85.32.5:51244/api/spotCheck/uploadExcel?id=${id}&name=${name}`
    // const urll = window.URL.createObjectURL(new Blob([data]), { type: 'application/vnd.ms-excel' })
    const link = document.createElement('a')
    link.style.display = 'none'
    link.href = url
    link.setAttribute('download', name)
    document.body.appendChild(link)
    link.click()
  },
  /**
   * select设置
   */
  selectedValue:function(){
		var self=this;
		var optionArr=["全部","班车客运抽检","旅游包车抽检","危险品运输抽检"];
		self.creatId("#industryType",optionArr);
		var optionArr1=["月","年"];
		self.creatId("#monDateType",optionArr1);
		self.creatId("#vehSelectDateType",optionArr1);
		var optionArr2=["2019000001","2019000002","2019000003","20190000004","2019000005"];
		// self.creatId("#samplingBatck",optionArr2);
		var optionArr3=["全部","班车客运抽检","旅游包车抽检","危险品运输抽检"];
    self.creatId("#selectIndustry_type",optionArr3);
    var optionArr4 = ["5%","10%","15%","20%","25%","30%","35%","40%","45%","50%","55%","60%","65%","70%","75%","80%","85%","90%","95%","100%"];
    self.creatId("#queryPropor",optionArr4);
	},
	creatId:function(id,optionArr){
		$(id).html();
		var str="";
		$.each(optionArr,function (i) {
			str+="<option value='"+optionArr[i]+"'>"+optionArr[i]+"</option>"
		});
		$(id).html(str);
		$(id).comboSelect();
	},

  btnEvent() {
    $(".ZCJ_vehSelect").hide();
    $(".j-search-row .item").hide();
    $(".select_MYtime").show();
    $(".cgstatus_num").show();
    $(".operatorBtn").show();
    // $("#samplingTimeY").hide();

    // $(".content_sheng").on("click",".carSearchName",function() {
    //   // 背景图切换
    //   vehicleSamp.resetQueryData(); // 重置
    //   $(this).addClass("activeName").siblings().removeClass("activeName");
    //   $(".content_shi div").removeClass("activeName");
    //   $(".j-search-row .item").hide();
    //   $(".operatorBtn").show();
    //   // 设置右侧显示隐藏
    //   $(".search_table").show();
    //   $(".ZCJ_vehSelect").hide();
    //   let index=$(this).index();
    //   if (index === 0) {
    //     vehicleSamp.data.pageNum = 1;
    //     $(".select_MYtime").show();
    //     $(".areaName").show();
    //     $(".table-con .title").html("部抽检报表查询");
    //     vehicleSamp.getBuSampReport();
    //   } else if (index === 1) {
    //     vehicleSamp.data.pageNum = 2;
    //     $(".select_MYtime").show();
    //     $(".work_type").show();
    //     $(".areaName").show();
    //     $(".vehicleNo").show();
    //     $(".table-con .title").html("部抽检车辆查询");
    //     vehicleSamp.getBuSampVehicle();
    //   }
    // });

    // $("input.combo-input").attr("readonly",true)

    $(".content_shi").on("click",".carSearchName",function() {
      // 背景图切换
      vehicleSamp.resetQueryData(); // 重置
      $(this).addClass("activeName").siblings().removeClass("activeName");
      $(".content_sheng div").removeClass("activeName");
      $(".j-search-row .item").hide();
      $(".operatorBtn").show();
      // 设置右侧显示隐藏
      let index=$(this).index();
      vehicleSamp.data.pageNum = index + 3;
      if (index === 0) {
        $(".search_table").show();
        $(".ZCJ_vehSelect").hide();
        $(".select_MYtime").show();
        $(".cgstatus_num").show();
        $(".table-con .title").html("抽检报表查询");
        vehicleSamp.getZiSampReport();
      } else if (index === 1) {
        $(".search_table").show();
        $(".ZCJ_vehSelect").hide();
        $(".select_MYtime").show();
        $(".work_type").show();
        $(".areaName").show();
        $(".cgstatus_num").show();
        $(".table-con .title").html("抽检车辆查询");
        vehicleSamp.getZiSampVehicle();
      } else if (index === 2) {
        vehicleSamp.selectQueryCarInputInit(); // 车辆查询页面地区级联数据加载
        $(".queryCaritem button").attr("disabled",true);
        $(".queryCaritem button").addClass("btndisabled");
        $(".select_carbtn button").attr("disabled",true);
        $(".select_carbtn button").addClass("btndisabled");
        vehicleSamp.resetSearchCarQueryData();
        // vehicleSamp.data.pageNum = 5;
        $(".j-search-row.queryCar_search .item").show();
        $(".ZCJ_vehSelect").show();
        $(".search_table").hide();
        vehicleSamp.getCarInfoList();
        vehicleSamp.initSearchCarTableRight();

      }
    });

    $(".sampSearch_btn").click(() => { // 查询
      vehicleSamp.queryTableData();
    })
    $(".sampReset_btn").click(() => { // 重置
      vehicleSamp.resetQueryData();
    });
    $(".queryCar_btn button:first-child").click(() => { // 车辆列表查询
      vehicleSamp.queryTableData();
    })
    $(".queryCar_btn button:last-child").click(() => { // 车辆列表重置
      vehicleSamp.resetSearchCarQueryData();
      vehicleSamp.data.SearchCarTableData = [];
      vehicleSamp.initSearchCarListTable();
    })
    $(".select_carbtn button:first-child").click(() => {
      console.log("选择车辆")
      console.log(this.data.selectCarArrData,"勾选数据")
      this.data.searchCarRightTableData = this.data.selectCarArrData;
      this.initSearchCarTableRight();
    })
    $(".select_carbtn button:nth-child(2)").click(() => { // 随机选择车辆/抽检
      this.data.searchCarRightTableData = [];
      this.initSearchCarTableRight();
      vehicleSamp.getCarSearchRightData();
    })
    $(".queryCaritem button:first-child").click(() => { // 启动抽检
      var queryData = {};
      var timeType = $("#vehSelectDateType option:selected").val();
      if (timeType === "月") {
        queryData.time = $("#samplingTimeSeleteM").val();
      } else if (timeType === "年") {
        queryData.time = $("#samplingTimeSeleteY").val();
      }
      if (vehicleSamp.data.searchCarRightTableData) {
        var arr = [];
        vehicleSamp.data.searchCarRightTableData.forEach((item) => {
          arr.push(item.id);
        })
        queryData.carIds = arr.join(",");
      } else {
        queryData.carIds = "";
      }
      jrequest.get("/api/spotCheck/addExcel",queryData).then(res => {
        // console.log(res)
      })
    })
    $(".queryCaritem button:last-child").click(() => { // 清空
      vehicleSamp.data.searchCarRightTableData = [];
      $('#chartsDataList').bootstrapTable('destroy');
      vehicleSamp.initChartsTable("chartsDataList",vehicleSamp.data.searchCarRightTableData,vehicleSamp.data.shengColum);
      if (vehicleSamp.data.searchCarRightTableData.length === 0) {
        $(".queryCaritem button").attr("disabled",true);
      $(".queryCaritem button").addClass("btndisabled");
      }
    })

    // 表格操作 选择，取消选择，选择全部，取消选择全部
    $("#carInformationList").on('check.bs.table',(e,row,$element) => {
      vehicleSamp.data.selectCarArrData.push(row)
    })
    $("#carInformationList").on('uncheck.bs.table',(e,row,$element) => {
      vehicleSamp.data.selectCarArrData = vehicleSamp.data.selectCarArrData.filter(item => row.id != item.id)
    })
    $("#carInformationList").on('check-all.bs.table',() => {
      vehicleSamp.data.selectCarArrData = vehicleSamp.data.searchCarRightTableData
    })
    $("#carInformationList").on('uncheck-all.bs.table',() => {
      vehicleSamp.data.selectCarArrData = []
    })

    $("#monDateType").change(function() { // 时间选择
      var num = $("#monDateType option:selected").val();
      if (num === "月") {
        $(".J-yearMonthPicker-single").show();
        $(".J-yearPicker-single").hide();
      } else if (num === "年") {
        $(".J-yearMonthPicker-single").hide();
        $(".J-yearPicker-single").show();
      }
    })
    $("#vehSelectDateType").change(function() { // 车辆列表时间选择
      var num = $("#vehSelectDateType option:selected").val();
      if (num === "月") {
        $(".J-yearMonthPicker-single.searchcar").show();
        $(".J-yearPicker-single").hide();
      } else if (num === "年") {
        $(".J-yearMonthPicker-single.searchcar").hide();
        $(".J-yearPicker-single").show();
      }
    })
  }
}


$(function() {
  window.operateEvents = {
    'click .downFile': function (e, value, row, index) { // 下载
      var queryData = {};
      queryData.id = row.id;
      var date = moment().format("YYYY-MM-DD");
      queryData.name = "联网联控重点营运车辆抽查情况分析报告-" + date + ".xls";
      let  http="http://1.85.32.5:51244";
      let urlS = "/api/spotCheck/uploadExcel";
      var Authorization = window.localStorage.getItem("auth_token") || ''
      $.ajax({
        headers: {
          Authorization: Authorization
        },
        contentType: "application/json;charset=utf-8",
        // responseType: 'blob',
        dataType: "json",
        data: queryData,
        url: HTTP + urlS,
        type: "get",
        success: function (data) {
          vehicleSamp.downloads(queryData.id,queryData.name);
        },
        error: function (err) {
          vehicleSamp.downloads(queryData.id,queryData.name);
        }
      });
    },
  }
  vehicleSamp.initPage();
})
